package 代码记录.指定公司代码练习记录.西安.分值100分;

import java.util.Scanner;

/**
 * @author zx
 * @create 2023-06-29 21:07
 * 难题：照着人家的思路我自己用自己熟悉的API做的
 */
public class 整数编码 {//2---copy
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = Integer.toString(n,2);//转为二进制字符串
        boolean ishave = false;
        StringBuilder sb = new StringBuilder();
        while(str.length() > 0){
            if(str.length() > 7){
                ishave = true;
            }else{
                ishave = false;
                while(str.length() < 7){//这里2进制不足7位时补0
                    str = "0" + str;
                }
            }
            String subStr = str.substring(str.length() - 7,str.length());
            str = str.substring(0,str.length() - 7);
            if(ishave){
                subStr = "1" + subStr;
            }else{
                subStr = "0" + subStr;
            }
            int k = Integer.parseInt(subStr, 2);
            String resStr = Integer.toString(k, 16);
            if(resStr.length() < 2){//这里16进制不足2位补0
                resStr = "0" + resStr;
            }
            char[] arr = resStr.toCharArray();
            for(int i = 0;i < arr.length;i++){
                char c = arr[i];
                if(c >= 'a' && c <= 'z'){
                    arr[i] = (char)(c - 32);
                }
            }
            resStr = String.valueOf(arr);
            System.out.println(resStr);
            sb.append(resStr);
        }
        System.out.println(sb);
    }
}
